package com.cpecc.model.system;

import java.io.Serializable;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;

import org.hibernate.annotations.GenericGenerator;

@Entity
@Table(name = "SYS_USER")
public class User implements Serializable{
	
	/**
	 * 
	 */
	private static final long serialVersionUID = -7428224639595936526L;

	@Id
	@GeneratedValue(generator = "system-uuid")
	@GenericGenerator(name = "system-uuid", strategy = "uuid")
	@Column(length = 32)
	private String id;
	
	@Column(length = 50)
	private String userName;
	
	@Column(length = 32)
	private String password;

	@Column(length = 32)
	private String name;	
	
	@Column(length=32)
	private String email;
	
	@ManyToOne
	@JoinColumn(name="DEP_ID")
	private Dep dep;
	
	@ManyToOne
	@JoinColumn(name="ROLE_ID")
	private Role role;
	
	@Column(length = 1)
	private String gangWei;
	
	@Column
	private boolean locked;
	
	public String getId() {
		return id;
	}

	public void setId(String id) {
		this.id = id;
	}

	public String getUserName() {
		return userName;
	}

	public void setUserName(String userName) {
		this.userName = userName;
	}

	public String getPassword() {
		return password;
	}

	public void setPassword(String password) {
		this.password = password;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public String getEmail() {
		return email;
	}

	public void setEmail(String email) {
		this.email = email;
	}	

	public Dep getDep() {
		return dep;
	}

	public void setDep(Dep dep) {
		this.dep = dep;
	}

	public Role getRole() {
		return role;
	}

	public void setRole(Role role) {
		this.role = role;
	}	

	public String getGangWei() {
		return gangWei;
	}

	public void setGangWei(String gangWei) {
		this.gangWei = gangWei;
	}	

	public boolean isLocked() {
		return locked;
	}

	public void setLocked(boolean locked) {
		this.locked = locked;
	}	

	public User(String id, String userName, String password, String name,
			String email, Dep dep, Role role, String gangWei, boolean locked) {
		super();
		this.id = id;
		this.userName = userName;
		this.password = password;
		this.name = name;
		this.email = email;
		this.dep = dep;
		this.role = role;
		this.gangWei = gangWei;
		this.locked = locked;
	}

	public User() {
		super();
	}	
}